package com.kpx.app.utils.uiutils;

import android.content.Context;
import android.location.LocationManager;

import com.kpx.app.Application;
import com.kpx.app.R;

/**
 * 作者： Ryan
 * 描述：地图工具类
 * 创建时间：2015/3/30 13:51.
 */
public class MapUtils {
    public static boolean isValidateLatitude(double latitude) {
        return latitude <= 90 && latitude >= -90;
    }

    public static boolean isValidateLogitude(double longitude) {
        return longitude <= 180 && longitude >= -180;
    }

    public static boolean isLocationAccessable(Context context) {
        LocationManager locationManager = (LocationManager) Application.instance.getSystemService(Context.LOCATION_SERVICE);
        boolean gpsEnable = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        if (!gpsEnable && null != context) {
            ToastUtil.getInstance().showDialog(context, context.getString(R.string.tip_open_gps));
        }
        return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
    }

}
